//
//  DODBObjectManager.h
//  DOFramework
//
//  Created by 鞠 文杰 on 14-5-13.
//  Copyright (c) 2014年 dono. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "DOConstants.h"
#import <sqlite3.h>
@class DBMetaInfo;

/**
 *  负责维护数据库相关信息
 */
@interface DODBManager : NSObject

- (sqlite3 *)database;

- (NSInteger)currentVersion;

//- (void)setVersion:(int)version;

- (void)setVersion:(DBMetaInfo *)versionInfo
     withOperation:(UpgradeBlock)upgrade;

- (void)registerInMemory:(Class)clazz
              properties:(NSDictionary*)properties;

- (NSDictionary*)getClassProperties:(Class)clazz;

+ (DODBManager*)sharedSingleton;


+ (BOOL)existsClassInfo:(Class)clazz;

+ (void)registInMemoryWithClass:(Class)clazz
                           info:(NSMutableDictionary*)info;

+ (NSDictionary*)infoWithClass:(Class)clazz;

+ (NSInteger)primaryKeyWithClass:(NSString *)classname;


@property (nonatomic,strong) UpgradeBlock upgrade;
@property (nonatomic,strong) NSString *dbPath;
@end
